import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';

import { BaseResponse } from '@server/basic-dto';

export class CreateUserOrUserLoginDto {
  @ApiProperty({
    description: '用户名',
    type: String,
  })
  username: string;

  @ApiProperty({
    description: '密码',
    type: String,
  })
  password: string;
}

class UserLoginData {
  @ApiProperty({
    description: '用户名',
    type: String,
  })
  username: string;

  @ApiProperty({
    description: 'token',
    type: String,
  })
  token: string;
}

export class UserLoginResponse extends BaseResponse {
  @ApiProperty({
    description: '用户信息',
    type: UserLoginData,
  })
  @Type(() => UserLoginData)
  data?: UserLoginData;
}
